<!--conf
<sample in_favorites="false">
              <product version="2.0" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Context menu for specific column</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
</head>

<body onResize="return true;" oncontextmenu="return false;" >
	<h1>Context menu for specific column</h1>
    <p>In example below context menu is available for the first column only.</p>
	<table width="100%" border="0">
		<tr>
			<td>
				<div id="gridbox" style="width:100%;height:270px;background-color:white;"></div>
			</td>
    	</tr>
	</table>
<script>
	function onButtonClick(menuitemId,type){
                var data = mygrid.contextID.split("_"); //rowId_colInd
                mygrid.setRowTextStyle(data[0],"color:"+menuitemId.split("_")[1]);
				return true
	}
	function my_pre_func(rowId,celInd,grid){
	    if (celInd==1) return false;
	    return true;
	}
	menu = new dhtmlXMenuObject();
	menu.setIconsPath("../common/images/");
	menu.renderAsContextMenu();
	menu.attachEvent("onClick",onButtonClick);
	menu.loadStruct("../common/_context.xml");

	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("../../../codebase/imgs/");
	mygrid.setSkin("dhx_skyblue");
	mygrid.setHeader("Author,Title");
	mygrid.setInitWidths("250,250");
	mygrid.enableAutoWidth(true);
	mygrid.setColAlign("left,left");
	mygrid.setColTypes("ro,link");
	mygrid.setColSorting("str,str");
	
    mygrid.enableContextMenu(menu);
 	mygrid.attachEvent("onBeforeContextMenu",my_pre_func);
    mygrid.init();
	
	mygrid.loadXML("../common/grid_links.xml");
   
</script>
</body>
</html>
